<!DOCTYPE html>
<html>

<head>
    <meta name="layout" content="main2"/>
    <g:set var="entityName" value="${message(code: 'workflowInstance.label', default: 'workflowInstance')}"/>

    <title>工作流：${this.workflowInstance?.name}</title>
</head>

<body>

<div class="main-body">
    <div class="page-wrapper">
        <!-- Page-header start -->
        <div class="page-header">
            <div class="page-header-title">
                <h4>工作流：${this.workflowInstance?.name}</h4>
            </div>

            <div class="page-header-breadcrumb">
                <ul class="breadcrumb-title">
                    <li class="breadcrumb-item">
                        <a href="/salesDashboard/index">
                            <i class="icofont icofont-home"></i>
                        </a>
                    </li>
                    <li class="breadcrumb-item">
                        <g:link action="index" controller="workflowInstance">工作流列表</g:link>
                    </li>
                    <li class="breadcrumb-item"><a href="#!">工作流：${this.workflowInstance?.name}</a>
                    </li>
                </ul>
            </div>
        </div>
        <!-- Page-header end -->
        <!-- Page-body start -->
        <div class="page-body">

            <!-- Hover table card start -->
            <div class="card">
                <div class="card-header">
                    <h5>工作流：${this.workflowInstance?.name}</h5>

                    <div class="card-header-right">
                        <g:link action="edit" resource="${this.workflowInstance}" data-toggle="tooltip" data-placement="top"
                                title="" data-original-title="编辑">
                            <i class="icofont icofont-edit"></i>
                        </g:link>

                        <i class="icofont icofont-rounded-down"></i>
                    </div>
                </div>

                <div class="card-block">
                    <div class="form-group row">
                        <label class="col-md-2 col-form-label">名称</label>

                        <div class="col-md-3">
                            <span class="cont">${this.workflowInstance?.name}</span>
                        </div>
                        <label class="col-md-2 col-form-label">工作流</label>

                        <div class="col-md-3">
                            <span class="cont">${this.workflowInstance?.workflow?.name}</span>
                        </div>
                    </div>


                    <div class="form-group row">
                        <label class="col-md-2 col-form-label">当前阶段</label>

                        <div class="col-md-3">
                            <span class="cont">${this.workflowInstance?.stage?.name}</span>
                        </div>
                        <label class="col-md-2 col-form-label">当前状态</label>

                        <div class="col-md-3">
                            <span class="cont">${this.workflowInstance?.status?.name}</span>
                        </div>
                    </div>

                </div>

            </div>

            <div class="card">
                <div class="card-header">
                    <h5>工作流阶段</h5>

                    <div class="card-header-right">
                        <sec:ifNotGranted roles="ROLE_EVENT_CONFIGURATION,ROLE_CONDITION_RULEENGINE">
                            <g:link controller="workflowInstanceStage" action="create"
                                    params="[instance: this.workflowInstance?.id]"
                                    data-toggle="tooltip"
                                    data-placement="top" title=""
                                    data-original-title="新增"><i class="icofont icofont-plus"></i></g:link>

                        </sec:ifNotGranted>
                        <i class="icofont icofont-rounded-down"></i>
                    </div>
                </div>

                <div class="card-block dt-responsive">

                    <div class="table-responsive">
                        <div id="dom-jqry_wrapper" class="dataTables_wrapper dt-bootstrap4">
                            <div class="table-responsive">
                                <table class="table table-striped table-hover table-bordered">
                                    <thead>
                                    <tr>
                                        <g:sortableColumn property="executionSequence"
                                                          title="${message(code: 'workflowInstanceStage.executionSequence.label', default: '执行次序')}"/>
                                        <g:sortableColumn property="name"
                                                          title="${message(code: 'workflowInstanceStage.name.label', default: '名称')}"/>
                                        <g:sortableColumn property="canReject"
                                                          title="${message(code: 'workflowInstanceStage.canReject.label', default: '能否回退')}"/>
                                        <th class="text-center" width="15%">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <g:each in="${this.workflowInstanceStages}">
                                        <tr>
                                            <td>
                                                <g:link controller="workflowInstanceStage" action="show"
                                                        id="${it?.id}">${it?.executionSequence}</g:link>
                                            </td>
                                            <td>
                                                ${it?.name}
                                            </td>
                                            <td>${it?.canReject}</td>
                                            <td class="text-center">
                                                <g:link class="m-r-15 text-primary"
                                                        controller="workflowInstanceStage" action="edit"
                                                        id="${it?.id}">
                                                    <i class="icofont icofont-ui-edit"></i>
                                                </g:link>
                                                <sec:ifNotGranted roles="ROLE_EVENT_CONFIGURATION,ROLE_CONDITION_RULEENGINE">
                                                    <g:form controller="workflowInstanceStage" action="delete" id="${it.id}" class="inline"
                                                            method="DELETE">
                                                        <button class="deleteBtn text-danger" type="button">
                                                            <i class="icofont icofont-trash"></i>
                                                        </button>
                                                    </g:form>
                                                </sec:ifNotGranted>


                                            </td>

                                        </tr>
                                    </g:each>
                                    </tbody>

                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
            <!-- Hover table card end -->
        </div>

        <!-- Page-body end -->

    </div>
</div>

</body>

</html>

